import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-11-04
 * Time: 19:24
 */
public class Test {
    public static void main(String[] args) {
        Map<String, Integer> map = new TreeMap<>();

        map.put("hello", 1);
        map.put("world", 2);
        map.put("abcde", 3);

        System.out.println(map.get("world"));
        System.out.println(map.getOrDefault("abc", 555));
        System.out.println(map.remove("abcde",5));

        Set<String> set = map.keySet();
        System.out.println(set);

//        for (String set1 : set) {
//            System.out.println(set1);
//        }

        Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
        System.out.println(entrySet);

        for (Map.Entry<String, Integer> entry : entrySet) {
            System.out.println("key: " + entry.getKey() + " value: " + entry.getValue());
        }

        System.out.println("是否包含key == world: " + map.containsKey("world"));

        System.out.println("是否包含value == 5: " + map.containsValue(5));

        System.out.println("avsd");
    }
}
